home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SOUND.SWG / 0003_MODMUSIC.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  4KB  |  78 lines

  1.     MOD File DEMO
  2.  
  3.  
  4.  ST> I do, however, have the MOD File structures in a Text File.
  5.  ST> NetMail if you want them.
  6.  
  7.  EW> Hey..  Could you post them here if their not too long?
  8.  EW> All I have For MOD Files is a Program (so so) that plays them
  9.  EW> through the PCSpeaker, and it's *ALL* in Asm, and I'd love
  10.  EW> to be able to convert at least the File reading to pascal,
  11.  
  12.  The MOD File Format is not overly Complicated in itself, but the music
  13.  encoded therein is very intricate, since the notes use non-standard
  14.  notations For the frequency, and the effects For each note are very
  15.  involved.  I can, however, post a good skeleton For the File structure,
  16.  but if you want the effects commands, we'll have to go to NetMail,
  17.  since it would not be in Pascal.
  18.  
  19. Type SongNameT = String[20]; {This is the first structure in the File, the
  20.                               full name of the song in the File}
  21.      SampleT = Record        {This structure is Repeated 31 times, and
  22.                               describes each instrument}
  23.         Name     : String[22];
  24.         Len      : Word;     {Length of the sample wave pattern, which is
  25.                               Near the end of the File.  This number is
  26.                               the number of Words, use MUL 2 For Bytes}
  27.         FineTune : Byte;     {0-7 = 0 to +7, 8-F = -8 to -1 offset from
  28.                               normal played notes.  Useful For off-key
  29.                               instruments}
  30.         Volume   : Byte;     {0-64 Normal volume of instrument}
  31.         RepeatAt : Word;     {offset in Words of the start of the pattern
  32.                               Repeat For long notes.}
  33.         RepeatLn : Word;     {Length in Words of the Repeated part of the
  34.                               sample pattern}
  35.         end;
  36.  
  37.      VoiceT = Record  {This structure is not in the MOD File itself, but
  38.                        should help in organizing all of the voice's
  39.                        Charicteristics}
  40.         Sample  : Byte; {0-31    Which instrument sample to play}
  41.         note    : Word; {12 bits Which note. Non-standard strange numbers}
  42.         Effect  : Byte; {0-F     Effect to use on note}
  43.         EffectC : Byte; {00-FF   Control Variable to effect}
  44.         end;
  45.  
  46.      SongDataT = Record {This Record, at offset 950, contains inFormation
  47.                          about the song music itself}
  48.         SongLength : Byte; {1-128 Number of patterns (not wave) of
  49.                             sets of musical notes}
  50.         Fill1      : Byte; {Set to 127}
  51.         Patterns   : Array[0..127] of Byte; {0-63 Outline of song}
  52.                      {Tells which score to play where.  Number of
  53.                       patterns is the highest number here}
  54.         Initials   : String[4];             {"M.K.","FLT4", or "FLT8"}
  55.         end;
  56.  
  57.      PatternDataT = Array[1..4] of Byte; {This structure is Repeated
  58.                        four times For each note in the score (4 voices,
  59.                        4 Bytes each}
  60.  
  61.      {After this the wave patterns For the samples are placed}
  62.  
  63. Var Voice  : Array[1.. 4] of VoiceT;  {Four voices}
  64.     Sample : Array[1..31] of SampleT; {31 samples}
  65.  
  66. Procedure ParseData (Patt : PatternDataT, VoiceNum : Byte);
  67. {Stuffs voice With pattern data beFore playing}
  68. begin
  69.   Voice[VoiceNum].Sample  := (Patt[1] mod 16) shl 4 + (Patt[3] mod 16);
  70.   Voice[VoiceNum].note    := (Patt[2] shl 4) + (Patt[2] div 16);
  71.   Voice[VoiceNum].Effect  := (Patt[3] div 16;
  72.   Voice[VoiceNum].EffectC := Patt[4];
  73.   end;
  74.  
  75. Anyway, this should help explain how to do something With the File.
  76. if you need inFormation on what the numbers For the notes are or how
  77. to interprit the effects, send NetMail.
  78.